const express = require('express');
const session = require('express-session');

let app = express();

//3.配置
app.use(session({
    secret: 'admin',	  	  	//加密存储
    resave: false,		  	//客户端并行请求是否覆盖:true-是,false-否
    saveUninitialized: true  //初始化session存储
}));


app.get('/set', function (req, res) {
    req.session.a = 1;
    req.session.b = 2;
    req.session.c = 3;
    res.send('成功！！')
});

app.get('/get', function (req, res) {
    console.log(req.session.a);
    console.log(req.session.b);
    console.log(req.session.c);
    res.send('获取成功')
});


app.get('/del', function (req, res) {
    req.session.a = null;
    console.log(req.session.a);
    res.send('**************')
});


app.listen(8080);